#include <bits/stdc++.h>

using namespace std;

const int N = 1e5 + 10;

int n;
int r[N];
int c[N];

int main()
{
    freopen("duel.in", "r", stdin);
    freopen("duel.out", "w", stdout);
    scanf("%d", &n);
    for (int i = 1; i <= n; ++ i) scanf("%d", &r[i]), c[r[i]] ++ ;
    queue<int> q;
    int cnt = 0;
    for (int i = 1; i <= n; ++ i)
    {
        if (!c[i]) continue;
        while (c[i])
        {
            if (!q.empty() && q.front() < i)
            {
                q.push(i);
                q.pop();
                ++ cnt;
            }
            else q.push(i);
            -- c[i];
        }
        
    }
    printf("%d\n", n - cnt);
    return 0;
}